package com.luo.chengrui.module.sa.dal.mysql.matrix;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.luo.chengrui.module.sa.dal.dataobject.matrix.BusinessManagerMatrixDO;
import org.apache.ibatis.annotations.Mapper;
import com.luo.chengrui.module.sa.controller.admin.matrix.vo.*;

/**
 * 职能管理矩阵  Mapper
 *
 * @author luodz
 */
@Mapper
public interface BusinessManagerMatrixMapper extends BaseMapperX<BusinessManagerMatrixDO> {

    default PageResult<BusinessManagerMatrixDO> selectPage(BusinessManagerMatrixPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessManagerMatrixDO>()
                .likeIfPresent(BusinessManagerMatrixDO::getCode, reqVO.getCode())
                .likeIfPresent(BusinessManagerMatrixDO::getName, reqVO.getName())
                .eqIfPresent(BusinessManagerMatrixDO::getKindId, reqVO.getKindId())
                .eqIfPresent(BusinessManagerMatrixDO::getParentId, reqVO.getParentId())
                .eqIfPresent(BusinessManagerMatrixDO::getBusinessCode, reqVO.getBusinessCode())
                .eqIfPresent(BusinessManagerMatrixDO::getRemark, reqVO.getRemark())
                .eqIfPresent(BusinessManagerMatrixDO::getDataValues, reqVO.getDataValues())
                .eqIfPresent(BusinessManagerMatrixDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BusinessManagerMatrixDO::getVersion, reqVO.getVersion())
                .orderByDesc(BusinessManagerMatrixDO::getSort));
    }

    default List<BusinessManagerMatrixDO> selectList(BusinessManagerMatrixExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BusinessManagerMatrixDO>()
                .likeIfPresent(BusinessManagerMatrixDO::getCode, reqVO.getCode())
                .likeIfPresent(BusinessManagerMatrixDO::getName, reqVO.getName())
                .eqIfPresent(BusinessManagerMatrixDO::getKindId, reqVO.getKindId())
                .eqIfPresent(BusinessManagerMatrixDO::getParentId, reqVO.getParentId())
                .eqIfPresent(BusinessManagerMatrixDO::getBusinessCode, reqVO.getBusinessCode())
                .eqIfPresent(BusinessManagerMatrixDO::getRemark, reqVO.getRemark())
                .eqIfPresent(BusinessManagerMatrixDO::getSort, reqVO.getSort())
                .eqIfPresent(BusinessManagerMatrixDO::getDataValues, reqVO.getDataValues())
                .eqIfPresent(BusinessManagerMatrixDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BusinessManagerMatrixDO::getVersion, reqVO.getVersion())
                .orderByDesc(BusinessManagerMatrixDO::getSort));
    }

}
